Home

Operator Usage

Name

borrow-from-context

Description

borrow-from-context["context name", op] input-seq
borrow an operator from the given context
usually rules in different context are completely separate from each other
borrow-from-context[] allows you to "peek" at an operator in a different context
this allows you to keep your working context clean, while the back-end code is in another context
if the given context doesn't exist, then it will return the empty sequence


Examples

-- just an abstract example:
-- define an operator in some different contexts:
|context> => |alpha>
op |*> #=> |alpha> :_ |_self>
|context> => |beta>
op |*> #=> |beta> :_ |_self>
|context> => |gamma>
op |*> #=> |gamma> :_ |_self>

-- now make use of the borrow-from-context[] operator:
alpha-op |*> #=> borrow-from-context["alpha", op] |_self>
beta-op |*> #=> borrow-from-context["beta", op] |_self>
gamma-op |*> #=> borrow-from-context["gamma", op] |_self>

-- now invoke them:
alpha-op |input ket>
    |alpha: input ket>

beta-op |input ket>
    |beta: input ket>

gamma-op |input ket>
    |gamma: input ket>


See also

Operator type

sequence compound context